#include "CMinimap.h"
#include "..\CCyberSpaceState.h"

CMinimap::CMinimap(void)
{
	m_pAi = nullptr;
	m_pMap = nullptr;
}

CMinimap::~CMinimap(void)
{

}

void CMinimap::Update(float fElapsedTime)
{

}

void CMinimap::Render(void)
{
	/////////////////////////////////////////////////////////////////////
	// Display the node map
	if(m_pAi && m_pMap)
	{
		CSGD_Direct3D::GetInstance()->GetSprite()->Flush();
		vector<CNode*>* nodes =  m_pMap->getNodes();
		int nSize = (*nodes).size();
		bool bFlashing = CCyberSpaceState::GetInstance()->GetFlashing();

		if(nSize == 4) // If there are four nodes DONE
		{
			// Draw player node
			RECT rPlayerNode;
			rPlayerNode.left = 50;
			rPlayerNode.top = 390;
			rPlayerNode.right = rPlayerNode.left + 10;
			rPlayerNode.bottom = rPlayerNode.top + 10;

			RECT rNodeOne;
			rNodeOne.left = 80;
			rNodeOne.top = 370;
			rNodeOne.right = rNodeOne.left + 10;
			rNodeOne.bottom = rNodeOne.top + 10;

			RECT rNodeTwo;
			rNodeTwo.left = 80;
			rNodeTwo.top = 410;
			rNodeTwo.right = rNodeTwo.left + 10;
			rNodeTwo.bottom = rNodeTwo.top + 10;

			// Draw enemy node
			RECT rEnemyNode;
			rEnemyNode.left = 115;
			rEnemyNode.top = 390;
			rEnemyNode.right = rEnemyNode.left + 10;
			rEnemyNode.bottom = rEnemyNode.top + 10;
			if(m_pMap->getcurNode() == (*nodes)[0])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[0])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[0]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 0, 255);
					else if((*nodes)[0]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[1])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[1])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[1]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 0, 255);
					else if((*nodes)[1]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[2])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[2])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[2]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 0, 255);
					else if((*nodes)[2]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[3])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[3])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[3]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 0, 255);
					else if((*nodes)[3]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
			}
		}


		if(nSize == 5) // If there are 5 nodes DONE
		{
			// Draw player node
			RECT rPlayerNode;
			rPlayerNode.left = 50;
			rPlayerNode.top = 390;
			rPlayerNode.right = rPlayerNode.left + 10;
			rPlayerNode.bottom = rPlayerNode.top + 10;

			RECT rNodeOne;
			rNodeOne.left = 80;
			rNodeOne.top = 370;
			rNodeOne.right = rNodeOne.left + 10;
			rNodeOne.bottom = rNodeOne.top + 10;

			RECT rNodeTwo;
			rNodeTwo.left = 80;
			rNodeTwo.top = 390;
			rNodeTwo.right = rNodeTwo.left + 10;
			rNodeTwo.bottom = rNodeTwo.top + 10;

			RECT rNodeThree;
			rNodeThree.left = 80;
			rNodeThree.top = 410;
			rNodeThree.right = rNodeThree.left + 10;
			rNodeThree.bottom = rNodeThree.top + 10;

			// Draw enemy node
			RECT rEnemyNode;
			rEnemyNode.left = 115;
			rEnemyNode.top = 390;
			rEnemyNode.right = rEnemyNode.left + 10;
			rEnemyNode.bottom = rEnemyNode.top + 10;

			if(m_pMap->getcurNode() == (*nodes)[0])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[0])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[0]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 0, 255);
					else if((*nodes)[0]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[1])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[1])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[1]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 0, 255);
					else if((*nodes)[1]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[2])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[2])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[2]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 0, 255);
					else if((*nodes)[2]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[3])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[3])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[3]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 0, 255);
					else if((*nodes)[3]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[4])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[4])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[4]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 0, 255);
					else if((*nodes)[4]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
			}
		}

		if(nSize == 6) // If there are 6 nodes DONE
		{
			// Draw player node
			RECT rPlayerNode;
			rPlayerNode.left = 50;
			rPlayerNode.top = 390;
			rPlayerNode.right = rPlayerNode.left + 10;
			rPlayerNode.bottom = rPlayerNode.top + 10;

			RECT rNodeOne;
			rNodeOne.left = 70;
			rNodeOne.top = 370;
			rNodeOne.right = rNodeOne.left + 10;
			rNodeOne.bottom = rNodeOne.top + 10;

			RECT rNodeTwo;
			rNodeTwo.left = 70;
			rNodeTwo.top = 410;
			rNodeTwo.right = rNodeTwo.left + 10;
			rNodeTwo.bottom = rNodeTwo.top + 10;

			RECT rNodeThree;
			rNodeThree.left = 90;
			rNodeThree.top = 370;
			rNodeThree.right = rNodeThree.left + 10;
			rNodeThree.bottom = rNodeThree.top + 10;

			RECT rNodeFour;
			rNodeFour.left = 90;
			rNodeFour.top = 410;
			rNodeFour.right = rNodeFour.left + 10;
			rNodeFour.bottom = rNodeFour.top + 10;

			// Draw enemy node
			RECT rEnemyNode;
			rEnemyNode.left = 115;
			rEnemyNode.top = 390;
			rEnemyNode.right = rEnemyNode.left + 10;
			rEnemyNode.bottom = rEnemyNode.top + 10;

			if(m_pMap->getcurNode() == (*nodes)[0])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[0]) // if the AI is trying to capture the node
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
				else
				{ // Display the nodes state
					
					if((*nodes)[0]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 0, 255);
					else if((*nodes)[0]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[1])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[1])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
				else
				{ // Display the nodes state
					if((*nodes)[1]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 0, 255);
					else if((*nodes)[1]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[2])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[2])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
				else
				{ // Display the nodes state
					if((*nodes)[2]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 0, 255);
					else if((*nodes)[2]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[3])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[3])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
				else
				{ // Display the nodes state
					if((*nodes)[3]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 0, 255);
					else if((*nodes)[3]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[4])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[4])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 255);
				}
				else
				{ // Display the nodes state
					if((*nodes)[4]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 0, 0, 255);
					else if((*nodes)[4]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[5])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[5])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
				else
				{ // Display the nodes state
					if((*nodes)[5]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 0, 255);
					else if((*nodes)[5]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
			}
		}

		if(nSize == 7) // If there are 7 nodes     ( move left +30 and top -30 DONE
		{
			// Draw player node
			RECT rPlayerNode;
			rPlayerNode.left = 50;
			rPlayerNode.top = 390;
			rPlayerNode.right = rPlayerNode.left + 10;
			rPlayerNode.bottom = rPlayerNode.top + 10;

			RECT rNodeOne;
			rNodeOne.left = 70;
			rNodeOne.top = 370;
			rNodeOne.right = rNodeOne.left + 10;
			rNodeOne.bottom = rNodeOne.top + 10;

			RECT rNodeTwo;
			rNodeTwo.left = 70;
			rNodeTwo.top = 410;
			rNodeTwo.right = rNodeTwo.left + 10;
			rNodeTwo.bottom = rNodeTwo.top + 10;

			RECT rNodeThree;
			rNodeThree.left = 80;
			rNodeThree.top = 390;
			rNodeThree.right = rNodeThree.left + 10;
			rNodeThree.bottom = rNodeThree.top + 10;

			RECT rNodeFour;
			rNodeFour.left = 90;
			rNodeFour.top = 370;
			rNodeFour.right = rNodeFour.left + 10;
			rNodeFour.bottom = rNodeFour.top + 10;

			RECT rNodeFive;
			rNodeFive.left = 90;
			rNodeFive.top = 410;
			rNodeFive.right = rNodeFive.left + 10;
			rNodeFive.bottom = rNodeFive.top + 10;

			// Draw enemy node
			RECT rEnemyNode;
			rEnemyNode.left = 115;
			rEnemyNode.top = 390;
			rEnemyNode.right = rEnemyNode.left + 10;
			rEnemyNode.bottom = rEnemyNode.top + 10;

			if(m_pMap->getcurNode() == (*nodes)[0])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[0])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[0]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 0, 255);
					else if((*nodes)[0]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[1])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[1])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[1]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 0, 255);
					else if((*nodes)[1]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[2])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[2])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[2]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 0, 255);
					else if((*nodes)[2]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[3])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[3])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[3]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 0, 255);
					else if((*nodes)[3]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[4])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[4])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[4]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 0, 0, 255);
					else if((*nodes)[4]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[5])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[5])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[5]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 0, 0, 255);
					else if((*nodes)[5]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[6])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[6])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[6]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 0, 255);
					else if((*nodes)[6]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
			}
		}

		if(nSize == 8) // If there are eight nodes DONE
		{
			// Draw player node
			RECT rPlayerNode;
			rPlayerNode.left = 50;
			rPlayerNode.top = 380;
			rPlayerNode.right = rPlayerNode.left + 10;
			rPlayerNode.bottom = rPlayerNode.top + 10;

			RECT rNodeOne;
			rNodeOne.left = 70;
			rNodeOne.top = 350;
			rNodeOne.right = rNodeOne.left + 10;
			rNodeOne.bottom = rNodeOne.top + 10;

			RECT rNodeTwo;
			rNodeTwo.left = 70;
			rNodeTwo.top = 410;
			rNodeTwo.right = rNodeTwo.left + 10;
			rNodeTwo.bottom = rNodeTwo.top + 10;

			RECT rNodeThree;
			rNodeThree.left = 80;
			rNodeThree.top = 370;
			rNodeThree.right = rNodeThree.left + 10;
			rNodeThree.bottom = rNodeThree.top + 10;

			RECT rNodeFour;
			rNodeFour.left = 80;
			rNodeFour.top = 390;
			rNodeFour.right = rNodeFour.left + 10;
			rNodeFour.bottom = rNodeFour.top + 10;

			RECT rNodeFive;
			rNodeFive.left = 90;
			rNodeFive.top = 350;
			rNodeFive.right = rNodeFive.left + 10;
			rNodeFive.bottom = rNodeFive.top + 10;

			RECT rNodeSix;
			rNodeSix.left = 90;
			rNodeSix.top = 410;
			rNodeSix.right = rNodeSix.left + 10;
			rNodeSix.bottom = rNodeSix.top + 10;

			// Draw enemy node
			RECT rEnemyNode;
			rEnemyNode.left = 115;
			rEnemyNode.top = 380;
			rEnemyNode.right = rEnemyNode.left + 10;
			rEnemyNode.bottom = rEnemyNode.top + 10;

			if(m_pMap->getcurNode() == (*nodes)[0])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[0])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[0]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 0, 0, 255);
					else if((*nodes)[0]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rPlayerNode, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[1])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[1])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[1]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 0, 0, 255);
					else if((*nodes)[1]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeOne, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[2])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[2])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[2]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 0, 0, 255);
					else if((*nodes)[2]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeTwo, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[3])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[3])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[3]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 0, 0, 255);
					else if((*nodes)[3]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeThree, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[4])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[4])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[4]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 0, 0, 255);
					else if((*nodes)[4]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFour, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[5])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[5])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[5]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 0, 0, 255);
					else if((*nodes)[5]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeFive, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[6])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rNodeSix, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[6])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeSix, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeSix, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[6]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeSix, 0, 0, 255);
					else if((*nodes)[6]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeSix, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rNodeSix, 255, 255, 255);
				}
			}

			if(m_pMap->getcurNode() == (*nodes)[7])
			{
				CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 255, 0);
			}
			else
			{
				if(m_pAi->GetChosen() == (*nodes)[7])
				{
					if(bFlashing)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
				else
				{
					// Display the node's state
					if((*nodes)[7]->GetOwner() == OWNER_PLAYER)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 0, 0, 255);
					else if((*nodes)[7]->GetOwner() == OWNER_AI)
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 0, 0);
					else
						CSGD_Direct3D::GetInstance()->DrawRect(rEnemyNode, 255, 255, 255);
				}
			}
		}

	}
}